// 小数补0
const toPercentage = (value: number, padNum = 2) => {
	if (!value) {
		return '0';
	}
	let percentage = (value * 100).toFixed(2);
	if (Number(percentage) > 100) {
		percentage = '100';
	}
	return percentage.padStart(padNum, '0') + '%';
};

export default toPercentage;
